<template>
  <div>
    <div class="tishi">
      <img src="../../../assets/laoding.png" alt="" />
      <p>网络连接异常，{{ time }}秒后系统自动刷新</p>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      time: 0,
    };
  },
  components: {},
  mounted() {
    this.go();
  },
  methods: {
    go() {
      this.time = 3; //赋值3秒
      var times = setInterval(() => {
        this.time--; //递减
        if (this.time <= 0) {
          // <=0 变成获取按钮
          console.log("结束计时器，退出");
          clearInterval(times);
          window.history.go(-1);
        }
      }, 1000);
    },
  },
};
</script>

<style scoped="scoped">
.tishi {
  width: 100%;
  text-align: center;
}
.tishi > img {
  width: 200px;
  height: 200px;
  margin: 20px 0;
}
</style>

